import { handleActions as createReducer } from 'redux-actions'
import { decrement, increment } from '../actions/counter.actions'
const initialState = {
  count: 0
}

export default createReducer(
  {
    [increment]: (state, action) => ({
      count: state.count + action.payload
    }),
    [decrement]: (state, action) => ({
      count: state.count - action.payload
    })
  },
  initialState
)
